<?php
/**
 * 订单结算
 * User: tengyu
 * Date: 2017/9/5
 * Time: 15:37
 */?>
@extends('common.common')
@section('title','结算订单')
@section('css')
    <link rel="stylesheet" href="{{asset('/css/confirmOrder.css')}}">
@endsection
@section('js')
    <script src="{{asset('/js/distpicker.data.js')}}"></script>
    <script src="{{asset('/js/distpicker.js')}}"></script>
    <script src="{{asset('/js/main.js')}}"></script>
    <script src="{{asset('/js/confirmOrder.js')}}"></script>
    <script>
        /**新增收货地址*/
        function addaddr_submit(id)
        {
            /**数据校验*/
            var rename = $("#ModalBox input[name='rename']").val();
            if(!rename){
                alert('收货人不能为空!');return false;
            }
            var addr_area = $("#province1 option:selected").val();
            if(!addr_area){
                alert('收货地址省/直辖市不能为空!');return false;
            }
            var addr_city = $("#city1 option:selected").val();
            if(!addr_city){
                alert('收货地址市/直辖市郊县不能为空!');return false;
            }
            var addr_town = $("#district1 option:selected").val();
            if(!addr_town && (JSON.stringify(addr_city) != '天津市郊县' || JSON.stringify(addr_city) != '上海市郊县' || JSON.stringify(addr_city) != '重庆市郊县')){
                alert('收货郊县地址不能为空!');return false;
            }
            var addr_detail = $("#ModalBox input[name='addr_detail']").val();
            if(!addr_detail){
                alert('收货详细地址不能为空!');return false;
            }
            /**是否选作默认收货地址判断*/
            var addr_status =$("input[type='checkbox']").is(':checked');
            if(!addr_status){
                addr_status = '0';
            }else{
                addr_status = '1';
            }
            var rephone = $("#ModalBox input[name='rephone']").val();
            if(!rephone){
                alert('收货人联系不能为空!');return false;
            }
            $.ajax({
                url:'/user/addaddr/'+id,
                type:'post',
                headers: { 'X-CSRF-TOKEN' : '{{ csrf_token() }}' },
                data:{
                    'rename':rename,'addr_area':addr_area, 'addr_city':addr_city,
                    'addr_town':addr_town, 'addr_detail':addr_detail,'rephone':rephone,
                    'addr_status':addr_status
                },
                dataType:'json',
                success:function(res){
                    if(res.res == 'ok'){
                        alert('新增地址成功!');
                        history.go(0);
                    }else{
                        alert('新增地址失败!');
                    }
                }
            });
        }
        /**设置默认地址*/
        function default_addr(id)
        {
            $.ajax({
                url:'/user/addr/default/'+id,
                type:'get',
                dataType:'json',
                success:function(res){
                    if(res.res == 'ok'){
                        history.go(0);
                    }else{
                        alert('选择地址失败!');
                    }
                }
            });
        }
        /**地址删除*/
        function addr_destroy(id)
        {
            $.ajax({
                url:'/user/addrdestroy/'+id,
                type:'get',
                dataType:'json',
                success:function(res){
                    if(res.res == 'ok'){
                        alert(res.msg);
                        history.go(0);
                    }else{
                        alert(res.msg);
                    }
                }
            });
        }
        /**商品下单数量变更-*/
        function decrecart(cartid,num)
        {
            if(num-1<1){
                common_deletecart(cartid);
            }else{
                num = num-1;
                common_cartedit(cartid,num);
            }
        }
        /**商品下单数量变更+*/
        function increcart(cartid,num)
        {
            num = num+1;
            common_cartedit(cartid,num);
        }
        /**立即租赁操作*/
        function rentorder()
        {
            /**租赁费*/
            var rentbill = $("span[name='rentbill']").text();
            /**押金*/
            var rentbond= $("span[name='rentbond']").text();
            if(!rentbond){
                rentbond=0;
            }
            /**当期信用额度*/
            var quota_current = $("span[name='quota_current']").text();
            /**商品所需信用额度*/
             var quotapay = $("span[name='quotapay']").text();
            /**优惠金额*/
            var coupon= $("#coupon_decrement").text();
            /**用户优惠券表数据id*/
            var user_coupon_id = $("input[name='user_coupon_id']").val();
            /**使用优惠券id*/
            var coupon_dtid = $("input[name='coupon_dtid']").val();
            /**给卖家留言*/
            var orders_user_require = $("input[name='orders_user_require']").val();
            /**邮费*/
            var postage = $("span[name='postage']").text();
            /**订单合计*/
            var orderamount = $("span[name='orderamount']").text();
            /**实付款*/
            var realpay = $("span[name='realpay']").text();
            /**获取当前购物车数据*/
            var mycart=new Array();
            $("ul.orders").each(function() {
                mycart.push($(this).attr('cid'));
            });
            $.ajax({
                url:'/cartorder',
                type:'post',
                headers: { 'X-CSRF-TOKEN' : '{{ csrf_token() }}' },
                data:{
                    'mycart':mycart,'rentbill':rentbill.substring(1),'rentbond':rentbond,
                    'postage':postage,'orderamount':orderamount.substring(1),
                    'orders_user_require':orders_user_require, 'quotapay':quotapay,'quota_current':quota_current,
                    'realpay':realpay.substring(1),'coupon':coupon.substring(1),'coupon_dtid':coupon_dtid,'user_coupon_id':user_coupon_id
                },
                dataType:'json',
                success:function(res){
                    if(res.res == 'ok'){
                        alert(res.msg);
                        window.location.href = res.redirect+'?id='+res.id;
                    }else{
                        alert(res.msg);
                    }
                }
            });
        }
    </script>
@endsection
@section('content')
    <div id="content">
    @include('common.centernav')
        <div class="container">
            <!--选择收货地址面板-->
            <div class="panel panel-default">
            <div class="panel-heading">
                <h4>选择收货地址</h4>
            </div>
            <div class="panel-body">
                <ul class="address">
                @if(count($param['addr'])>0)
                    @foreach($param['addr'] as $v)
                    <li>
                        <div class="border <?php if($v->addr_status == '1'){echo 'choosed';};?>">
                            <div class="col-xs-1">@if($v->addr_status == '1')<b></b>@else<b onclick="default_addr({{$v->addr_id}})"></b>@endif</div>
                        <div class="col-xs-10">
                        <p>地址:{{$v->addr_area}}&nbsp;{{$v->addr_city}}&nbsp;{{$v->addr_town}}&nbsp;{{$v->addr_detail}}</p>
                        <p>姓名:{{$v->addr_rename}}</p>
                        <p>联系方式:{{$v->addr_rephone}}</p>
                        <p><span onclick="addr_destroy({{$v->addr_id}})">删除</span>
                        @if($v->addr_status == '1')
                        <span class="rt">已设为收货地址</span>
                        @else
                        <span class="rt" onclick="default_addr({{$v->addr_id}})">设为收货地址</span>
                        @endif
                        </p>
                    </div></div></li>
                    @endforeach
                @endif
                <!--添加新地址-->
                    <li id="addAddress">
                        <div class="border"><div data-toggle="modal" data-target="#ModalBox">+</div><p>新增收货地址</p></div>
                    </li>
                </ul>
            </div>
        </div>
            <!--确认订单信息面板-->
            <div id="panel" class="panel panel-default">
                <div class="panel-heading"><h4>确认订单信息</h4></div>
                <div class="panel-body">
                    <ul class="product list-inline">
                        <li>商品信息</li>
                        <li>单价</li>
                        <li>数量</li>
                        <li>押金</li>
                        <li>时长</li>
                    </ul>
                    @if(!isset($param['immediate']) && empty($param['immediate']))
                        @foreach($param['cart']['cartlist_status'] as $v)
                        <ul class="orders list-inline" cid="{{$v->cart_id}}">
                            <li class="imgInfo">
                                <img src="{{asset('/img/checked.jpg')}}">
                                <div class="media">
                                    <div class="media-left"><img src="{{asset(env('STATIC_FILE_ERP_PATH').$v->fitment_details_imgOne)}}" style="width: 151px;height:92px;"></div>
                                    <div class="media-body">
                                        <p>{{$v->fitments_name}}</p>
                                        <p>
                                        <?php
                                        $color=DB::table('fitment_color')->where('color_details_id',$v->details_id)->select('color_type')->get();
                                        ?>
                                        @foreach($color as $key=>$value)
                                            <img src="{{$param['color'][$value->color_type]}}" alt="当前家具颜色">
                                        @endforeach
                                        </p>
                                    </div>
                                </div>
                            </li>
                            <li class="money">¥<span>@if($v->cart_rent_type == 2){{$v->details_fixprice}}@else{{$v->details_nimbleprice}}@endif</span>/月</li>
                            <li class="calNum">
                                <b class="glyphicon glyphicon-minus-sign" onclick="decrecart({{$v->cart_id}},{{$v->cart_fitment_num}})"></b>
                                <span>{{$v->cart_fitment_num}}</span>
                                <b class="glyphicon glyphicon-plus-sign" onclick="increcart({{$v->cart_id}},{{$v->cart_fitment_num}})"></b>
                            </li>
                            <li class="money">¥<span>@if($v->cart_rent_type == 2){{'0'}}@else{{$v->details_nimbleprice*2}}@endif</span></li>
                            <li class="selectDate">
                                <span class="active">@if($v->cart_rent_type == 2){{'18个月'}}@else{{'12个月'}}@endif</span>
                            </li>
                        </ul>
                        @endforeach
                        <!--结算总计-->
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-xs-6">
                                    <input class="form-control" type="text" name="orders_user_require" placeholder="给卖家留言" maxlength="255">
                                </div>
                                <div class="col-xs-6">
                                    <div class="col-xs-2">总计</div>
                                    <div class="col-xs-10">
                                        <p>租赁费用：<span class="bigSpan color" name="rentbill">¥{{$param['cart']['countprice']}}</span>@if($param['cart']['countbond']>0)+押金：¥<span class="bigSpan color" name="rentbond">{{$param['cart']['countbond']}}</span></p>@endif
                                        <div class="flex"><p>运送方式：<b>普通快递</b><span class="color">邮费自付</span></p><span class="color">0.00</span></div>
                                        <!---优惠券研发中 start-->
                                        <div class="useCoupon flex">
                                            <div class="outPosition">
                                                已使用优惠券
                                                <i class="forDown"><s id="coupon">优惠券使用</s><u id="xsCoupon"></u></i>
                                                <div id="xzCoupon" class="coupon">
                                                    <ul>
                                                        @foreach($param['confirm_coupon'] as $k=>$v)
                                                        <li coupon_dtid="{{$v->coupon_id}}" user_coupon_id="{{$v->id}}">@if($v->coupon_type==1)
                                                            @if($param['cart']['countprice']>=$v->coupon_full)
                                                            <div><span>满</span><span>{{$v->coupon_full}}</span><span>-</span><span class="re_money">{{$v->coupon_cut}}</span></div>
                                                            <div><img class="img-responsive" src="{{asset(env('STATIC_FILE_ERP_PATH').$v->coupon_img)}}" alt="优惠券图片"></div>
                                                            @endif
                                                            @else
                                                            <div><span>抵用券</span><span class="re_money">{{$v->coupon_cash}}</span></div>
                                                            <div><img class="img-responsive" src="{{asset(env('STATIC_FILE_ERP_PATH').$v->coupon_img)}}" alt="现金券图片"></div>
                                                            @endif
                                                        </li>
                                                        @endforeach
                                                    </ul>
                                                </div>
                                            </div>
                                            <span class="color" id="coupon_decrement">0</span>
                                            <input type="hidden" name="coupon_dtid" value="">
                                            <input type="hidden" name="user_coupon_id" value="">
                                        </div>
                                        <!---优惠券 end-->
                                        <div class="noCashRange flex">
                                            <p>使用信用金额度</p>
                                            @if(!empty($param['user_quota']) && $param['cart']['countcoupon']!='')
                                            <u><span class="color" name="quota_current">{{$param['user_quota']->quota_current}}</span>-<span class="color" name="quotapay">{{round($param['cart']['countcoupon'])}}</span></u>
                                            @else
                                            <u>-<span class="color" name="quotapay">{{round($param['cart']['countcoupon'])}}</span></u>
                                            @endif
                                        </div>
                                        <div class="flex">
                                            <p>订单合计</p><span class="color" name="orderamount">¥{{$param['cart']['countprice']+$param['cart']['countbond']}}</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--底部结算-->
                        <div class="container-fluid">
                            <div class="bottom">
                                <div class="container-fluid">
                                    <div class="row">
                                        <div class="col-xs-offset-6 col-xs-6 bottomCal">
                                            <div>
                                            @if(!empty($param['user_quota']))
                                                @if($param['user_quota']->quota_current-$param['cart']['countcoupon']>0)
                                                <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['cart']['countprice']+$param['cart']['countbond']}}</span>
                                                <input type="hidden" name="count_realpay" value="{{$param['cart']['countprice']+$param['cart']['countbond']}}">
                                                @else
                                                <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['cart']['countprice']+$param['cart']['countbond']+($param['cart']['countcoupon']-$param['user_quota']->quota_current)}}</span>
                                                <input type="hidden" name="count_realpay" value="{{$param['cart']['countprice']+$param['cart']['countbond']+($param['cart']['countcoupon']-$param['user_quota']->quota_current)}}">
                                                @endif
                                            @else
                                                <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['cart']['countprice']+$param['cart']['countcoupon']+$param['cart']['countbond']}}</span>
                                                <input type="hidden" name="count_realpay" value="{{$param['cart']['countprice']+$param['cart']['countcoupon']+$param['cart']['countbond']}}">
                                            @endif
                                            </div>
                                            <div>
                                                <span>寄送至</span>
                                                <span>@if(count($param['addr'])>0){{$param['addr'][0]->addr_city}}{{$param['addr'][0]->addr_town}}{{$param['addr'][0]->addr_detail}}@endif</span>
                                            </div>
                                            <div class="goodsReceipt">
                                                <span>收货人:</span><span> @if(count($param['addr'])>0){{$param['addr'][0]->addr_rename}}@endif</span>
                                            </div>
                                            <div>
                                                @if(1>2)
                                                <a href="{{url('/user/quota_add')}}"><button class="btn btn-warning">提升信用额度</button></a>
                                                @endif
                                                <button class="btn rentNow" @if(count($param['addr'])>0) onclick="rentorder()" @else onclick="alert('请选填写收货地址信息!')" @endif>立即租赁</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    @else
                        <ul class="orders list-inline" cid="{{$param['immediate']->cart_id}}">
                            <li class="imgInfo">
                                <img src="{{asset('/img/checked.jpg')}}">
                                <div class="media">
                                    <div class="media-left">
                                        <img src="{{asset(env('STATIC_FILE_ERP_PATH').$param['immediate']->fitment_details_imgMaster)}}" style="width: 151px;height:92px;">
                                    </div>
                                    <div class="media-body">
                                        <p>{{$param['immediate']->details_name}}</p>
                                        <p><img src="{{asset('/img/color.jpg')}}"></p>
                                    </div>
                                </div>
                            </li>
                            <li class="money">¥<span>@if($param['immediate']->cart_rent_type == 2){{$param['immediate']->details_fixprice}}@else{{$param['immediate']->details_nimbleprice}}@endif</span>/月</li>
                            <li class="calNum">
                                <b class="glyphicon glyphicon-minus-sign" onclick="decrecart({{$param['immediate']->cart_id}},{{$param['immediate']->cart_fitment_num}})"></b>
                                <span>{{$param['immediate']->cart_fitment_num}}</span>
                                <b class="glyphicon glyphicon-plus-sign" onclick="increcart({{$param['immediate']->cart_id}},{{$param['immediate']->cart_fitment_num}})"></b>
                            </li>
                            <li class="money">
                                ¥<span>@if($param['immediate']->cart_rent_type == 2){{$param['immediate']->details_fixprice}}@else{{$param['immediate']->details_nimbleprice*2}}@endif</span>
                            </li>
                            <li class="selectDate">
                                <span class="active">@if($param['immediate']->cart_rent_type == 2){{'18个月'}}@else{{'12个月'}}@endif</span>
                            </li>
                        </ul>
                        <!--结算总计-->
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-xs-6">
                                    <input class="form-control" type="text" name="orders_user_require" placeholder="给卖家留言" maxlength="255">
                                </div>
                                <div class="col-xs-6">
                                    <div class="col-xs-2">总计</div>
                                    <div class="col-xs-10">
                                        <p>租赁费用:<span class="bigSpan color" name="rentbill">
                                            @if($param['immediate']->cart_rent_type==1)
                                            ¥{{($param['immediate']->details_nimbleprice)*($param['immediate']->cart_fitment_num)}}</span>
                                            +押金:
                                            ¥<span class="bigSpan color" name="rentbond">{{$param['immediate']->details_nimbleprice*2*$param['immediate']->cart_fitment_num}}</span>
                                            @else
                                            ¥{{($param['immediate']->details_fixprice)*($param['immediate']->cart_fitment_num)}}</span>
                                            @endif
                                        </p>
                                        <div class="flex"><p>运送方式：<b>普通快递</b><span class="color">邮费自付</span></p><span class="color">0.00</span></div>
                                        <!---优惠券研发中 start-->
                                        <div class="useCoupon flex">
                                            <div class="outPosition">
                                                已使用优惠券
                                                <i class="forDown">
                                                    <s id="coupon">优惠券使用</s>
                                                    <u id="xsCoupon"></u>
                                                </i>
                                                <div id="xzCoupon" class="coupon">
                                                    <ul>
                                                        @foreach($param['confirm_coupon'] as $k=>$v)
                                                            <li coupon_dtid="{{$v->coupon_id}}" user_coupon_id="{{$v->id}}">
                                                                @if($v->coupon_type==1)
                                                                @if($param['immediate']->cart_rent_type==1)
                                                                    @if($param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num>=$v->coupon_full)
                                                                    <div><span>满</span><span>{{$v->coupon_full}}</span><span>-</span><span class="re_money">{{$v->coupon_cut}}</span></div>
                                                                    <div><img class="img-responsive" src="{{asset(env('STATIC_FILE_ERP_PATH').$v->coupon_img)}}" alt="优惠券图片"></div>
                                                                    @endif
                                                                @else
                                                                    @if($param['immediate']->details_fixprice*$param['immediate']->cart_fitment_num>=$v->coupon_full)
                                                                    <div><span>满</span><span>{{$v->coupon_full}}</span><span>-</span><span class="re_money">{{$v->coupon_cut}}</span></div>
                                                                    <div><img class="img-responsive" src="{{asset(env('STATIC_FILE_ERP_PATH').$v->coupon_img)}}" alt="优惠券图片"></div>
                                                                    @endif
                                                                @endif
                                                                @else
                                                                <div><span>抵用券</span><span class="re_money">{{$v->coupon_cash}}</span></div>
                                                                <div><img class="img-responsive" src="{{asset(env('STATIC_FILE_ERP_PATH').$v->coupon_img)}}" alt="现金券图片" style="width: 46px;height: 14px;"></div>
                                                                @endif
                                                            </li>
                                                        @endforeach
                                                    </ul>
                                                </div>
                                            </div>
                                            <span class="color" id="coupon_decrement">0</span>
                                            <input type="hidden" name="coupon_dtid" value="">
                                            <input type="hidden" name="user_coupon_id" value="">
                                        </div>
                                        <!---优惠券 end-->
                                        <div class="noCashRange flex">
                                            <p>使用信用金额度</p>
                                            @if(!empty($param['user_quota']))
                                                <u><span class="color" name="quota_current">{{$param['user_quota']->quota_current}}</span>-<span class="color" name="quotapay">{{round($param['immediate']->details_bond*$param['immediate']->cart_fitment_num)}}</span></u>
                                            @else
                                                <u>-<span class="color" name="quotapay">{{round($param['immediate']->details_bond*$param['immediate']->cart_fitment_num)}}</span></u>
                                            @endif
                                        </div>
                                        <div class="flex">
                                            @if($param['immediate']->cart_rent_type==1)
                                            <p>订单合计</p><span class="color" name="orderamount">¥{{$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num+$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num*2}}</span>
                                            @else
                                            <p>订单合计</p><span class="color" name="orderamount">¥{{$param['immediate']->details_fixprice*$param['immediate']->cart_fitment_num}}</span>
                                            @endif
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!--底部结算-->
                        <div class="container-fluid">
                            <div class="bottom">
                                <div class="container-fluid">
                                    <div class="row">
                                        <div class="col-xs-offset-6 col-xs-6 bottomCal">
                                            <div>
                                            @if($param['immediate']->cart_rent_type==1)
                                                @if(!empty($param['user_quota']))
                                                    @if(($param['user_quota']->quota_current-$param['immediate']->cart_fitment_num*$param['immediate']->details_bond)>0)
                                                    <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num+$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num*2}}</span>
                                                    <input type="hidden" name="count_realpay" value="{{$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num+$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num*2}}">
                                                    @else
                                                    <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num+$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num*2+$param['immediate']->cart_fitment_num*$param['immediate']->details_bond-$param['user_quota']->quota_current}}</span>
                                                    <input type="hidden" name="count_realpay" value="{{$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num+$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num*2+$param['immediate']->cart_fitment_num*$param['immediate']->details_bond-$param['user_quota']->quota_current}}">
                                                    @endif
                                                @else
                                                    <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num+$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num*2+$param['immediate']->cart_fitment_num*$param['immediate']->details_bond}}</span>
                                                    <input type="hidden" name="count_realpay" value="{{$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num+$param['immediate']->details_nimbleprice*$param['immediate']->cart_fitment_num*2+$param['immediate']->cart_fitment_num*$param['immediate']->details_bond}}">
                                                @endif
                                            @else
                                                @if(!empty($param['user_quota']))
                                                    @if(($param['user_quota']->quota_current-$param['immediate']->cart_fitment_num*$param['immediate']->details_bond)>0)
                                                    <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['immediate']->details_fixprice*$param['immediate']->cart_fitment_num}}</span>
                                                    <input type="hidden" name="count_realpay" value="{{$param['immediate']->details_fixprice*$param['immediate']->cart_fitment_num}}">
                                                    @else
                                                    <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['immediate']->details_fixprice*$param['immediate']->cart_fitment_num+$param['immediate']->cart_fitment_num*$param['immediate']->details_bond-$param['user_quota']->quota_current}}</span>
                                                    <input type="hidden" name="count_realpay" value="{{$param['immediate']->details_fixprice*$param['immediate']->cart_fitment_num+$param['immediate']->cart_fitment_num*$param['immediate']->details_bond-$param['user_quota']->quota_current}}">
                                                    @endif
                                                @else
                                                    <p>实付款</p><span class="bigSpan color" name="realpay">¥{{$param['immediate']->details_fixprice*$param['immediate']->cart_fitment_num+$param['immediate']->cart_fitment_num*$param['immediate']->details_bond}}</span>
                                                    <input type="hidden" name="count_realpay" value="{{$param['immediate']->details_fixprice*$param['immediate']->cart_fitment_num+$param['immediate']->cart_fitment_num*$param['immediate']->details_bond}}">
                                                @endif
                                            @endif
                                            </div>
                                            <div>
                                                <span>寄送至</span>
                                                <span>@if(count($param['addr'])>0){{$param['addr'][0]->addr_city}}{{$param['addr'][0]->addr_town}}{{$param['addr'][0]->addr_detail}}@endif</span>
                                            </div>
                                            <div class="goodsReceipt">
                                                <span>收货人:</span><span> @if(count($param['addr'])>0){{$param['addr'][0]->addr_rename}}@endif</span>
                                            </div>
                                            <div>
                                                @if(1>2)
                                                <a href="{{url('/user/quota_add')}}"><button class="btn btn-warning">提升信用额度</button></a>
                                                @endif
                                                <button class="btn rentNow" @if(count($param['addr'])>0) onclick="rentorder()" @else onclick="alert('请选填写收货地址信息!')" @endif>立即租赁</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    @endif
                </div>
            </div>
        </div>
    </div>
    <!--修改地址模态框-->
    <div id="ModalBox" class="modal" data-backdrop="static">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <span class="close" data-dismiss="modal">&times;</span><h4 class="modal-title">新增收货地址</h4>
                </div>
                <div class="modal-body">
                    <form class="form-inline">
                        <div class="form-group">
                            <label class="control-label">收货人:</label>
                            <input type="text" class="form-control"  name="rename" value="{{old('rename')}}" placeholder="请输入收货人姓名">
                        </div>
                        <div class="form-group">
                            <label id="district" class="control-label">所在地区:</label>
                            <div id="selectAdd" data-toggle="distpicker">
                                <div class="form-group">
                                    <label class="sr-only" for="province1">Province</label>
                                    <select class="form-control" id="province1"></select>
                                </div>
                                <div class="form-group">
                                    <label class="sr-only" for="city1">City</label>
                                    <select class="form-control" id="city1"></select>
                                </div>
                                <div class="form-group">
                                    <label class="sr-only" for="district1">District</label>
                                    <select class="form-control" id="district1"></select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label">详细地址:</label>
                            <input type="text" class="form-control" name="addr_detail" value="{{old('addr_detail')}}" placeholder="请输入详细地址">
                        </div>
                        <div class="form-group">
                            <label class="control-label">联系方式:</label>
                            <input type="text" class="form-control" name="rephone" value="{{old('rephone')}}" placeholder="请输入收货人联系方式">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-warning lf" data-dismiss="modal"  onclick="addaddr_submit({{$user->id}})">提交</button>
                    <input type="checkbox">&nbsp;设置为默认地址
                </div>
            </div>
        </div>
    </div>
@endsection